<template>
  <div>
    <van-form>
      <div v-for="(i, v) in list" :key="v">
        <van-field
          :label=j.label
          v-for="(j, k) in i"
          :key="k"
          v-model="value[v+i.key]"
        />
      </div>
      <div>
          <van-button @click="add">+</van-button>
          <van-button>提交</van-button>

      </div>
    </van-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {},
      list: [
        [
          { label: "名称", key: "name" },
          { label: "类型", key: "type" },
          { label: "值", key: "value" },
        ],
      ],
      value: {},
      num: 1,
    };
  },
  methods: {
      add(){
          this.list.push([
          { label: "名称", key: "name" },
          { label: "类型", key: "type" },
          { label: "值", key: "value" },
        ])
        this.num += 1
      },
      save(){
          var lst=[]
          for(var i=0;i<this.num;i++){
              let name=i+name
              let type=i+type
              let value=i+value
              var dict={'name':this.value[name],'type':this.value[type],'value':this.value[value]}
              lst.push(dict)
          }
          console.log(dict)
      }
  },
  mounted () {
      
  }
};
</script>

<style>
</style>